//
//  LunBoCollectionViewCell.m
//  礼物说
//
//  Created by dllo on 16/4/21.
//  Copyright © 2016年 sunzhichao. All rights reserved.
//

#import "LunBoCollectionViewCell.h"

@interface LunBoCollectionViewCell ()<chuanZhiDelegate>

@property (nonatomic, retain) NSMutableArray * urlArrs;
@property (nonatomic, retain) NSMutableArray * array;

@end

@implementation LunBoCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        
    }
    return self;
}
- (void)dealloc{
    [_modelArr release];
    [_array release];
    [_urlArrs release];
    [_urlArr release];
    [super dealloc];
}

- (void)setModelArr:(NSMutableArray *)modelArr{
    if (_modelArr != modelArr) {
        [_modelArr release];
        _modelArr = [modelArr retain];
    }
    self.array = [NSMutableArray arrayWithArray:_modelArr];
}

- (void)setUrlArr:(NSMutableArray *)urlArr{
    if (_urlArr != urlArr) {
        [_urlArr release];
        _urlArr = [urlArr retain];
    }
    self.urlArrs = [NSMutableArray arrayWithArray:_urlArr];
    NSLog(@"%@",_urlArrs);
    [self createCell];
}
- (void)createCell{
    LunBoView * scroll = [[LunBoView alloc] initWithFrame:CGRectMake(0, 0, kWIDTHCELL, kHEIGHTCELL) UrlArr:_urlArr placeholderImage:@"placeholder@2x副本.jpg" Time:2];
    scroll.delegate = self;
    [self.contentView addSubview:scroll];
    [scroll release];
}

- (void)selectImageIndex:(NSInteger)index {
    UIViewController *viewController = [self inputViewController];
    ClassifyGongLvViewController * gongLvVc = [[ClassifyGongLvViewController alloc]init];
    LunBoModel *model = _array[index];
    gongLvVc.num = model.number;
    gongLvVc.Judge = @"zhuanTi";
    gongLvVc.titles = model.name;
    
    [viewController.navigationController pushViewController:gongLvVc animated:YES];
    [gongLvVc release];
    
    NSLog(@"%ld", (long)index);
}

- (UIViewController *)viewController {
    for (UIView *next = [self superview]; next; next = next.superview) {
        UIResponder *nexResponder = [next nextResponder];
        if ([nexResponder isKindOfClass:[UIViewController class]]) {
            return (UIViewController *)nexResponder;
        }
    }
    return nil;
}



@end
